<!DOCTYPE html>
<html>
<head>
    <include file="./public/sty.html"/>
	<link href="/style/css/city-picker.css" rel="stylesheet">
	<link href="/style/css/main.css" rel="stylesheet">
	<style>
		#distpicker{float: left; width: 360px;}
		#distpicker .title{ width: 320px; text-align: left; border: none;}
		#distpicker .city-picker-span{border:1px solid #ccc ; text-indent: 6px; height:32px !important; line-height: 32px;}
		#distpicker .city-picker-span .placeholder{height:32px !important; line-height: 32px;}
	</style>
	<style>
		.yz1,.yz2,.yz3,.yz4,.yz5,.yz6{text-align: left !important; margin-left: 20px;}
		.yz1 :before,.yz2 :before,.yz3 :before,.yz4 :before,.yz5 :before,.yz6 :before{ font-family: iconfont;
			font-style: inherit;
			padding: 0 5px;
			font-size: 14px;content: "\E60D";}
	</style>
</head>
<body>
<div id="app" class="manageBankcard">
    <include file="./public/header.html"/>

    <div class="container pt15 fix" s="[object Object]">
        <div class="slideUser">
            <ul class="sildeSession"><h3><span></span>账号管理</h3>
                <li class=""><a href="{:U('Users/personalInfo')}">个人信息</a></li>
                <li class="curr"><a href="{:U('Users/securityCenter')}">安全中心</a></li>
                <li class=""><a href="{:U('Users/manageBankcard2')}">银行卡管理</a></li>
            </ul>
            <ul class="sildeSession"><h3><span></span>投注管理</h3>
                <li><a href="{:U('Users/BetRecord')}" class="">投注记录</a></li>
                <li><a href="{:U('Users/seekOrder')}" class="">追号记录</a></li>
            </ul>
            <ul class="sildeSession"><h3><span></span>资金管理</h3>
                <li><a href="{:U('Users/BillRecord')}" class="">交易记录</a></li>
                <li class=""><a href="{:U('Users/PLstatement')}">今日盈亏</a></li>
            </ul>
			<?php if($wanjia['utype'] == '1'){ ?>
			<ul class="sildeSession">
				<h3><span></span>代理中心</h3>
				<li><a href="{:U('Users/agentIntro')}" class="">代理说明</a></li>
				<li class=""><a href="{:U('Users/agentReport')}">代理报表</a></li>
				<li><a href="{:U('Users/lowerReport')}" class="">下级报表</a></li>
				<li class=""><a href="{:U('Users/manageInvite')}">下级开户</a></li>
				<li><a href="{:U('Users/agentMember')}" class="">会员管理</a></li>
				<li><a href="{:U('Users/agentBetRecord')}" class="">投注明细</a></li>
				<li><a href="{:U('Users/agentBillRecord')}" class="">交易明细</a></li>
			</ul>
			<?php }?>
            <ul class="sildeSession"><h3><span></span>消息管理</h3>
                <li><a href="{:U('Users/letter')}" class="">站内信</a></li>
                <li><a href="{:U('Users/Notice')}" class="">网站公告</a></li>
            </ul>
        </div>
        <div class="userRight">
            <div class="userTitle mgb10">银行卡管理</div>
			<input type="hidden" name="" id="count" value="{$count}">
            <div class="userMain mgb10">
                <div class="bindCard">
                    <div class="fix">
						<foreach name="arra" item="v">
							<div class="cardItem">
								<div class="bankName">
								<i class="<?php if($v['bankid']=='1'){echo 'ICBC';}
									elseif($v['bankid']=='2'){echo 'CCB';}
									elseif($v['bankid']=='3'){echo 'ABC';}
									elseif($v['bankid']=='4'){echo 'CMBC';}
									elseif($v['bankid']=='5'){echo 'CMB';}
									elseif($v['bankid']=='6'){echo 'BCM';}
									elseif($v['bankid']=='7'){echo 'BOC';}
									elseif($v['bankid']=='8'){echo 'PSBC';}
									elseif($v['bankid']=='9'){echo 'CITIC';}
									elseif($v['bankid']=='10'){echo 'CIB';}
									elseif($v['bankid']=='11'){echo 'HXBANK';}
									elseif($v['bankid']=='12'){echo 'SPDB';}
									elseif($v['bankid']=='13'){echo 'GDB';}
									elseif($v['bankid']=='14'){echo 'SPABANK';}
									elseif($v['bankid']=='15'){echo 'CEB';}
									elseif($v['bankid']=='16'){echo 'CRCC';};?>">
								</i>
									<?php if($v["bankid"]=='1'){echo "工商银行";}
									        elseif($v["bankid"]=='2'){echo "建设银行";}
                                            elseif($v["bankid"]=='3'){echo "农业银行";}
                                            elseif($v["bankid"]=='4'){echo "民生银行";}
                                            elseif($v["bankid"]=='5'){echo "招商银行";}
                                            elseif($v["bankid"]=='6'){echo "交通银行";}
                                            elseif($v["bankid"]=='7'){echo "中国银行";}
                                            elseif($v["bankid"]=='8'){echo "邮政储蓄";}
                                            elseif($v["bankid"]=='9'){echo "中信银行";}
                                            elseif($v["bankid"]=='10'){echo "兴业银行";}
                                            elseif($v["bankid"]=='11'){echo "华夏银行";}
                                            elseif($v["bankid"]=='12'){echo "浦发银行";}
                                            elseif($v["bankid"]=='13'){echo "广发银行";}
                                            elseif($v["bankid"]=='14'){echo "平安银行";}
                                            elseif($v["bankid"]=='15'){echo "光大银行";}
                                            elseif($v["bankid"]=='16'){echo "农商银行";};?>
								</div>
									<div class="bankNum">尾号：
									     <?php echo "********".substr(trim($v['card']),-4);?>
									</div>
									<div class="cardInfo fix">
										<div class="cardStyle cardPink">储蓄卡<em></em></div>
										<div class="cardOperation">
											<span class="_islock">未锁定</span>
											<a href="{:U('Users/manageBankcard_upd',array('id'=>$v['id']))}" class="">修改</a>
										</div>
									</div>
									<div class="cardTxt"><span>绑卡日期：<?php echo date("Y-m-d",$v["ctime"]); ?></span> <em>{$v.uname}</em></div>
							</div>
			          </foreach>
						<a tag="div" id="tianjia" to="/manageBankcard" href="/Users/manageBankcard" class="add_bank cardEmpty cardItem ">立即添加银行卡</a>
                    </div>




                    <div class="userTip mgt15">
						<?php if(!empty($arra)){?>
							<p>
								<i></i>您已绑定<?php echo $count; ?>张银行卡，一共可以绑定5张银行卡。为了您的资金安全，成功提现的银行卡会自动锁定，无法删除和修改。
							</p>
						<?php }else{ ?>
							<p>
								<i></i>温馨提示：您尚未绑定银行卡，一共可以绑定5张银行卡。
							</p>
						<?php } ?>

					</div>
                </div>
            </div>
        </div>

    </div>
    <include file="./public/footer.html"/>
</div>


<script src="/style/js/bootstrap.js"></script>
<script src="/style/js/city-picker.data.js"></script>
<script src="/style/js/city-picker.js"></script>

<script src="/style/js/jquery.min.js"></script>
<script src="/style/js/fx.js"></script>
<script>
    $(function(){
        personalInfo();
		var count = $("#count").val();
		if(count >= '5'){
			$("#tianjia").hide();
		}

		$(".add_bank").click(function(){
			$(this).parents(".userRight").hide();
			$(".next_bank").show();
		})
    })
	$("body").on("click",".city-select.city a",function(){
		$("body").click();
	})

	//保存
	function sav(){
		var yinhang = $("#yinhang").val();
		var sheng = $('.city-picker-span .select-item:nth-of-type(1)').data("code");
		var shi = $('.city-picker-span .select-item:nth-of-type(2)').data("code");
		var name = $("#name").val();
		var kahao1 = $("#kahao1").val();
		var kahao2 = $("#kahao2").val();
		var mima = $("#mima").val();

		if(yinhang == ''){
			$(".yz1").html("<font color='red'>请选择开户银行</font>");
			return false;
		}else {
			$(".yz1").html("");
		}
		if(shi == null){
			$(".yz2").html("<font color='red'>请选择开户城市</font>");
			return false;
		}else {
			$(".yz2").html("");
		}
		if(name == ''){
			$(".yz3").html("<font color='red'>开户人姓名不能为空</font>");
			return false;
		}else {
			$(".yz3").html("");
		}
		if(kahao1 == ''){
			$(".yz4").html("<font color='red'>银行卡号不能为空</font>");
			return false;
		}else {
			$(".yz4").html("");
		}
       if(kahao1.length < 16 || kahao1.length > 19) {
		   $(".yz4").html("<font color='red'>银行卡号长度必须在16到19之间</font>");
			return false;
		}
		var num = /^\d*$/; //全数字
		if(!num.exec(kahao1)) {
			$(".yz4").html("<font color='red'>银行卡号必须全为数字</font>");
			return false;
		}
		//开头6位
		var strBin = "10,18,30,35,37,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,58,60,62,65,68,69,84,87,88,94,95,98,99";
		if(strBin.indexOf(kahao1.substring(0, 2)) == -1) {
			$(".yz4").html("<font color='red'>银行卡号开头6位不符合规范</font>");
			return false;
		}

		if(kahao2 == ''){
			$(".yz5").html("<font color='red'>确认卡号不能为空</font>");
			return false;
		}else {
			$(".yz5").html("");
		}
		if(kahao2 != kahao1){
			$(".yz5").html("<font color='red'>两次输入的卡号不正确</font>");
			return false;
		}else {
			$(".yz5").html("");
		}

		if(mima == ''){
			$(".yz6").html("<font color='red'>安全密码不能为空</font>");
			return false;
		}else {
			$(".yz6").html("");
		}
		$.ajax({
			type: "POST",
			url: "{:U('Users/manageBankcard')}",
			data: {'mima':mima,'yinhang':yinhang,'sheng':sheng,'shi':shi,'name':name,'kahao2':kahao2},
			success: function(dat){
				if(dat==0){
					$(".yz6").html("<font color='red'>安全密码不正确，请重新输入</font>");
				}else if(dat==1) {
					window.location.href="/Users/manageBankcard";
				}
			}
		});






	}


</script>
</body>
</html>